package com.lineage.server.serverpackets;

import java.util.concurrent.atomic.AtomicInteger;

public class S_Message_YN extends ServerBasePacket {
  private byte[] _byte;
  
  private static AtomicInteger _sequentialNumber = new AtomicInteger(1);
  
  public S_Message_YN(int type) {
    this._byte = null;
    writeC(219);
    writeH(0);
    writeD(0);
    writeH(type);
  }
  
  public S_Message_YN(String name) {
    this._byte = null;
    writeC(219);
    writeH(0);
    writeD(_sequentialNumber.incrementAndGet());
    writeH(252);
    writeS(name);
  }
  
  public S_Message_YN(int type, String msg) {
    this._byte = null;
    writeC(219);
    writeH(0);
    writeD(0);
    writeH(type);
    writeS(msg);
  }
  
  public S_Message_YN(int type, String msg1, String msg2) {
    this._byte = null;
    writeC(219);
    writeH(0);
    writeD(0);
    writeH(type);
    writeS(msg1);
    writeS(msg2);
  }
  
  public byte[] getContent() {
    if (this._byte == null)
      this._byte = getBytes(); 
    return this._byte;
  }
  
  public String getType() {
    return getClass().getSimpleName();
  }
}
